package com.example.projectmanagement.model;

import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.time.LocalDateTime;

@Entity
@Table(name = "sys_permission")
@Data
@NoArgsConstructor
@AllArgsConstructor
@EntityListeners(AuditingEntityListener.class)
public class Permission {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Column(name = "permission_name", unique = true, nullable = false)
    private String permissionName;
    
    @Column(name = "permission_code", unique = true, nullable = false)
    private String permissionCode;
    
    @Column(name = "resource_type", nullable = false)
    private String resourceType;
    
    @Column(name = "action", nullable = false)
    private String action;
    
    @Column(name = "description")
    private String description;
    
    @CreatedDate
    @Column(name = "create_time", updatable = false)
    private LocalDateTime createTime;
}